<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>
            function f1(){
                alert(window.location);
            }
        </script>
    </head>
    <body>

        <button type="button" onclick="f1();">test</button>
        <button type="button" onclick="window.location='1.html';">test</button>

    </body>
</html>